.class public Lcom/hierynomus/spnego/a;
.super Lcom/hierynomus/spnego/d;
.source "NegTokenInit.java"


# instance fields
.field private c:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Lcom/hierynomus/asn1/m;",
            ">;"
        }
    .end annotation
.end field

.field private d:[B


# direct methods
.method public constructor <init>()V
    .locals 2

    const/4 v0, 0x0

    const-string v1, "NegTokenInit"

    .line 1
    invoke-direct {p0, v0, v1}, Lcom/hierynomus/spnego/d;-><init>(ILjava/lang/String;)V

    .line 2
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/hierynomus/spnego/a;->c:Ljava/util/List;

    return-void
.end method

.method private a(Lcom/hierynomus/asn1/f;)V
    .locals 5

    .line 23
    iget-object v0, p0, Lcom/hierynomus/spnego/a;->d:[B

    if-eqz v0, :cond_0

    array-length v0, v0

    if-lez v0, :cond_0

    .line 24
    new-instance v0, Lcom/hierynomus/asn1/f1;

    const/4 v1, 0x1

    const/4 v2, 0x2

    new-instance v3, Lcom/hierynomus/asn1/w0;

    iget-object v4, p0, Lcom/hierynomus/spnego/a;->d:[B

    invoke-direct {v3, v4}, Lcom/hierynomus/asn1/w0;-><init>([B)V

    invoke-direct {v0, v1, v2, v3}, Lcom/hierynomus/asn1/f1;-><init>(ZILcom/hierynomus/asn1/e;)V

    .line 25
    invoke-virtual {p1, v0}, Lcom/hierynomus/asn1/f;->a(Lcom/hierynomus/asn1/e;)V

    :cond_0
    return-void
.end method

.method private a(Lcom/hierynomus/asn1/q;)V
    .locals 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/hierynomus/spnego/SpnegoException;
        }
    .end annotation

    .line 20
    instance-of v0, p1, Lcom/hierynomus/asn1/n;

    if-eqz v0, :cond_0

    .line 21
    check-cast p1, Lcom/hierynomus/asn1/n;

    invoke-virtual {p1}, Lcom/hierynomus/asn1/n;->j()[B

    move-result-object p1

    iput-object p1, p0, Lcom/hierynomus/spnego/a;->d:[B

    return-void

    .line 22
    :cond_0
    new-instance v0, Lcom/hierynomus/spnego/SpnegoException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Expected the MechToken (OCTET_STRING) contents, not: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-direct {v0, p1}, Lcom/hierynomus/spnego/SpnegoException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method private b(Lcom/hierynomus/asn1/f;)V
    .locals 5

    .line 14
    iget-object v0, p0, Lcom/hierynomus/spnego/a;->c:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-lez v0, :cond_1

    .line 15
    new-instance v0, Lcom/hierynomus/asn1/f;

    invoke-direct {v0}, Lcom/hierynomus/asn1/f;-><init>()V

    .line 16
    iget-object v1, p0, Lcom/hierynomus/spnego/a;->c:Ljava/util/List;

    invoke-interface {v1}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_0

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/hierynomus/asn1/m;

    .line 17
    invoke-virtual {v0, v2}, Lcom/hierynomus/asn1/f;->a(Lcom/hierynomus/asn1/e;)V

    goto :goto_0

    .line 18
    :cond_0
    new-instance v1, Lcom/hierynomus/asn1/f1;

    const/4 v2, 0x1

    const/4 v3, 0x0

    new-instance v4, Lcom/hierynomus/asn1/a1;

    invoke-direct {v4, v0}, Lcom/hierynomus/asn1/a1;-><init>(Lcom/hierynomus/asn1/f;)V

    invoke-direct {v1, v2, v3, v4}, Lcom/hierynomus/asn1/f1;-><init>(ZILcom/hierynomus/asn1/e;)V

    .line 19
    invoke-virtual {p1, v1}, Lcom/hierynomus/asn1/f;->a(Lcom/hierynomus/asn1/e;)V

    :cond_1
    return-void
.end method

.method private b(Lcom/hierynomus/asn1/q;)V
    .locals 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/hierynomus/spnego/SpnegoException;
        }
    .end annotation

    .line 6
    instance-of v0, p1, Lcom/hierynomus/asn1/r;

    if-eqz v0, :cond_2

    .line 7
    check-cast p1, Lcom/hierynomus/asn1/r;

    invoke-virtual {p1}, Lcom/hierynomus/asn1/r;->j()Ljava/util/Enumeration;

    move-result-object p1

    .line 8
    :goto_0
    invoke-interface {p1}, Ljava/util/Enumeration;->hasMoreElements()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 9
    invoke-interface {p1}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/hierynomus/asn1/e;

    .line 10
    instance-of v1, v0, Lcom/hierynomus/asn1/m;

    if-eqz v1, :cond_0

    .line 11
    iget-object v1, p0, Lcom/hierynomus/spnego/a;->c:Ljava/util/List;

    check-cast v0, Lcom/hierynomus/asn1/m;

    invoke-interface {v1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_0

    .line 12
    :cond_0
    new-instance p1, Lcom/hierynomus/spnego/SpnegoException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Expected a MechType (OBJECT IDENTIFIER) as contents of the MechTypeList, not: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-direct {p1, v0}, Lcom/hierynomus/spnego/SpnegoException;-><init>(Ljava/lang/String;)V

    throw p1

    :cond_1
    return-void

    .line 13
    :cond_2
    new-instance v0, Lcom/hierynomus/spnego/SpnegoException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Expected the MechTypeList (SEQUENCE) contents, not: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-direct {v0, p1}, Lcom/hierynomus/spnego/SpnegoException;-><init>(Ljava/lang/String;)V

    goto :goto_2

    :goto_1
    throw v0

    :goto_2
    goto :goto_1
.end method


# virtual methods
.method public a(Lcom/hierynomus/protocol/commons/buffer/Buffer;)Lcom/hierynomus/spnego/a;
    .locals 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lcom/hierynomus/protocol/commons/buffer/Buffer<",
            "*>;)",
            "Lcom/hierynomus/spnego/a;"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 2
    :try_start_0
    new-instance v0, Lcom/hierynomus/asn1/i;

    invoke-virtual {p1}, Lcom/hierynomus/protocol/commons/buffer/Buffer;->b()Ljava/io/InputStream;

    move-result-object p1

    invoke-direct {v0, p1}, Lcom/hierynomus/asn1/i;-><init>(Ljava/io/InputStream;)V

    invoke-virtual {v0}, Lcom/hierynomus/asn1/i;->readObject()Lcom/hierynomus/asn1/q;

    move-result-object p1

    .line 3
    instance-of v0, p1, Lcom/hierynomus/asn1/z;
    :try_end_0
    .catch Lcom/hierynomus/spnego/SpnegoException; {:try_start_0 .. :try_end_0} :catch_0

    const-string v1, "Incorrect GSS-API ASN.1 token received, expected to find an [APPLICATION 0], not: "

    if-nez v0, :cond_1

    :try_start_1
    instance-of v0, p1, Lcom/hierynomus/asn1/l0;

    if-eqz v0, :cond_0

    goto :goto_0

    .line 4
    :cond_0
    new-instance v0, Lcom/hierynomus/spnego/SpnegoException;

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-direct {v0, p1}, Lcom/hierynomus/spnego/SpnegoException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 5
    :cond_1
    :goto_0
    instance-of v0, p1, Lcom/hierynomus/asn1/z;

    const/16 v2, 0x10

    if-eqz v0, :cond_2

    .line 6
    check-cast p1, Lcom/hierynomus/asn1/z;

    invoke-virtual {p1, v2}, Lcom/hierynomus/asn1/a;->a(I)Lcom/hierynomus/asn1/q;

    move-result-object p1

    check-cast p1, Lcom/hierynomus/asn1/r;

    goto :goto_1

    .line 7
    :cond_2
    instance-of v0, p1, Lcom/hierynomus/asn1/l0;

    if-eqz v0, :cond_4

    .line 8
    check-cast p1, Lcom/hierynomus/asn1/l0;

    invoke-virtual {p1, v2}, Lcom/hierynomus/asn1/a;->a(I)Lcom/hierynomus/asn1/q;

    move-result-object p1

    check-cast p1, Lcom/hierynomus/asn1/r;

    :goto_1
    const/4 v0, 0x0

    .line 9
    invoke-virtual {p1, v0}, Lcom/hierynomus/asn1/r;->a(I)Lcom/hierynomus/asn1/e;

    move-result-object v0

    .line 10
    instance-of v1, v0, Lcom/hierynomus/asn1/m;

    if-eqz v1, :cond_3

    const/4 v0, 0x1

    .line 11
    invoke-virtual {p1, v0}, Lcom/hierynomus/asn1/r;->a(I)Lcom/hierynomus/asn1/e;

    move-result-object p1

    invoke-virtual {p0, p1}, Lcom/hierynomus/spnego/d;->a(Lcom/hierynomus/asn1/e;)V

    return-object p0

    .line 12
    :cond_3
    new-instance p1, Lcom/hierynomus/spnego/SpnegoException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Expected to find the SPNEGO OID ("

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    sget-object v2, Lcom/hierynomus/spnego/c;->a:Lcom/hierynomus/asn1/m;

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    const-string v2, "), not: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-direct {p1, v0}, Lcom/hierynomus/spnego/SpnegoException;-><init>(Ljava/lang/String;)V

    throw p1

    .line 13
    :cond_4
    new-instance v0, Lcom/hierynomus/spnego/SpnegoException;

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-direct {v0, p1}, Lcom/hierynomus/spnego/SpnegoException;-><init>(Ljava/lang/String;)V

    throw v0
    :try_end_1
    .catch Lcom/hierynomus/spnego/SpnegoException; {:try_start_1 .. :try_end_1} :catch_0

    :catch_0
    move-exception p1

    .line 14
    new-instance v0, Lcom/hierynomus/smbj/common/SMBRuntimeException;

    invoke-direct {v0, p1}, Lcom/hierynomus/smbj/common/SMBRuntimeException;-><init>(Ljava/lang/Throwable;)V

    throw v0
.end method

.method public a([B)Lcom/hierynomus/spnego/a;
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    new-instance v0, Lcom/hierynomus/protocol/commons/buffer/Buffer$b;

    sget-object v1, Lcom/hierynomus/protocol/commons/buffer/a;->a:Lcom/hierynomus/protocol/commons/buffer/a;

    invoke-direct {v0, p1, v1}, Lcom/hierynomus/protocol/commons/buffer/Buffer$b;-><init>([BLcom/hierynomus/protocol/commons/buffer/a;)V

    invoke-virtual {p0, v0}, Lcom/hierynomus/spnego/a;->a(Lcom/hierynomus/protocol/commons/buffer/Buffer;)Lcom/hierynomus/spnego/a;

    return-object p0
.end method

.method public a()Ljava/util/List;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List<",
            "Lcom/hierynomus/asn1/m;",
            ">;"
        }
    .end annotation

    .line 27
    iget-object v0, p0, Lcom/hierynomus/spnego/a;->c:Ljava/util/List;

    return-object v0
.end method

.method public a(Lcom/hierynomus/asn1/m;)V
    .locals 1

    .line 26
    iget-object v0, p0, Lcom/hierynomus/spnego/a;->c:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    return-void
.end method

.method protected a(Lcom/hierynomus/asn1/w;)V
    .locals 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/hierynomus/spnego/SpnegoException;
        }
    .end annotation

    .line 15
    invoke-virtual {p1}, Lcom/hierynomus/asn1/w;->j()Lcom/hierynomus/asn1/q;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v1, "not_defined_in_RFC4178@please_ignore"

    invoke-virtual {v0, v1}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_0

    return-void

    .line 16
    :cond_0
    invoke-virtual {p1}, Lcom/hierynomus/asn1/w;->k()I

    move-result v0

    if-eqz v0, :cond_2

    const/4 v1, 0x2

    if-ne v0, v1, :cond_1

    .line 17
    invoke-virtual {p1}, Lcom/hierynomus/asn1/w;->j()Lcom/hierynomus/asn1/q;

    move-result-object p1

    invoke-direct {p0, p1}, Lcom/hierynomus/spnego/a;->a(Lcom/hierynomus/asn1/q;)V

    goto :goto_0

    .line 18
    :cond_1
    new-instance v0, Lcom/hierynomus/spnego/SpnegoException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Unknown Object Tag "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Lcom/hierynomus/asn1/w;->k()I

    move-result p1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string p1, " encountered."

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-direct {v0, p1}, Lcom/hierynomus/spnego/SpnegoException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 19
    :cond_2
    invoke-virtual {p1}, Lcom/hierynomus/asn1/w;->j()Lcom/hierynomus/asn1/q;

    move-result-object p1

    invoke-direct {p0, p1}, Lcom/hierynomus/spnego/a;->b(Lcom/hierynomus/asn1/q;)V

    :goto_0
    return-void
.end method

.method public b(Lcom/hierynomus/protocol/commons/buffer/Buffer;)V
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lcom/hierynomus/protocol/commons/buffer/Buffer<",
            "*>;)V"
        }
    .end annotation

    .line 1
    :try_start_0
    new-instance v0, Lcom/hierynomus/asn1/f;

    invoke-direct {v0}, Lcom/hierynomus/asn1/f;-><init>()V

    .line 2
    invoke-direct {p0, v0}, Lcom/hierynomus/spnego/a;->b(Lcom/hierynomus/asn1/f;)V

    .line 3
    invoke-direct {p0, v0}, Lcom/hierynomus/spnego/a;->a(Lcom/hierynomus/asn1/f;)V

    .line 4
    invoke-virtual {p0, p1, v0}, Lcom/hierynomus/spnego/d;->a(Lcom/hierynomus/protocol/commons/buffer/Buffer;Lcom/hierynomus/asn1/f;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    return-void

    :catch_0
    move-exception p1

    .line 5
    new-instance v0, Lcom/hierynomus/smbj/common/SMBRuntimeException;

    invoke-direct {v0, p1}, Lcom/hierynomus/smbj/common/SMBRuntimeException;-><init>(Ljava/lang/Throwable;)V

    throw v0
.end method

.method public b([B)V
    .locals 0

    .line 20
    iput-object p1, p0, Lcom/hierynomus/spnego/a;->d:[B

    return-void
.end method
